package com.aplink.generic.pojo.formdesign;

import java.io.Serializable;

import android.text.TextUtils;

import com.aplink.generic.dialog.ApLinkProgressDialog;
import com.aplink.generic.dialog.SparseDialog;
import com.aplink.generic.dictionary.GenericDictionary;
import com.aplink.generic.pojo.controlspec.ControlSpec;
import com.aplink.generic.pojo.controlspec.actionbar.ActionBarSpec;
import com.aplink.generic.util.ResourcesHelper;

public class FormDesign implements Serializable {
	private static final long serialVersionUID = 8498276770745825724L;
	private boolean hasGallery;
	private boolean hasListView;
	private boolean isAlwayLoadFirstRecord;
	private SparseDialog mAlertDialog;
	private ApLinkProgressDialog mApLinkProgressDialog;
	private GenericDictionary<String, ControlSpec> mControlSpecCollection;
	private String mGalleryID = null;
	private InitValue mInitValue;
	private Layout mLayout;
	private String mListViewID = null;
	private ActionBarSpec mOptionMenu;
	private SelectWhere mSelectWhere;

	public FormDesign() {
		mAlertDialog = new SparseDialog();
		mControlSpecCollection = new GenericDictionary<>();
	}

	public ActionBarSpec getActionBar() {
		return this.mOptionMenu;
	}

	public SparseDialog getAlertDialog() {
		return this.mAlertDialog;
	}

	public String getAnimationIn() {
		return mLayout.getAnimationIn();
	}

	public int getAnimationInID() {
		if (TextUtils.isEmpty(this.mLayout.getAnimationIn())) {
			return ResourcesHelper.RESOURCE_NOT_FOUND;
		}
		return ResourcesHelper.getAnimationIdByName(this.mLayout
				.getAnimationIn());
	}

	public String getAnimationOut() {
		return this.mLayout.getAnimationOut();
	}

	public int getAnimationOutID() {
		if (TextUtils.isEmpty(this.mLayout.getAnimationOut())) {
			return ResourcesHelper.RESOURCE_NOT_FOUND;
		}
		return ResourcesHelper.getAnimationIdByName(this.mLayout
				.getAnimationOut());
	}

	public ApLinkProgressDialog getApLinkProgressDialog() {
		return this.mApLinkProgressDialog;
	}

	public GenericDictionary<String, ControlSpec> getControlSpecCollection() {
		return mControlSpecCollection;
	}

	public String getGalleryID() {
		return this.mGalleryID;
	}

	public InitValue getInitValue() {
		return this.mInitValue;
	}

	public String getLayout() {
		return this.mLayout.getLayoutName();
	}

	public int getLayoutID() {
		return ResourcesHelper.getLayoutIdByName(this.mLayout.getLayoutName());
	}

	public String getListViewID() {
		return this.mListViewID;
	}

	public ActionBarSpec getOptionMenu() {
		return this.mOptionMenu;
	}

	public SelectWhere getSelectWhere() {
		return this.mSelectWhere;
	}

	public boolean hasActionBar() {
		return mOptionMenu != null;
	}

	public boolean hasOptionMenu() {
		return this.mOptionMenu != null;
	}

	public boolean isAlwayLoadFirstRecord() {
		return this.isAlwayLoadFirstRecord;
	}

	public final boolean isEnableNavigateDrawer() {
		return mLayout.isEnableNavigateDrawer();
	}

	public boolean isHasGallery() {
		return this.hasGallery;
	}

	public boolean isHasListView() {
		return this.hasListView;
	}

	public void setActionBar(final ActionBarSpec optionMenu) {
		this.mOptionMenu = optionMenu;
	}

	public final void setAlertDialog(SparseDialog alertDialog) {
		mAlertDialog = alertDialog;
	}

	public void setAlwayLoadFirstRecord(final boolean isAlwayLoadFirstRecord) {
		this.isAlwayLoadFirstRecord = isAlwayLoadFirstRecord;
	}

	public void setApLinkProgressDialog(
			final ApLinkProgressDialog apLinkProgressDialog) {
		this.mApLinkProgressDialog = apLinkProgressDialog;
	}

	public void setControlSpecCollection(
			GenericDictionary<String, ControlSpec> controlSpecCollection) {
		mControlSpecCollection = controlSpecCollection;
	}

	public void setGalleryID(final String galleryID) {
		this.mGalleryID = galleryID;
	}

	public void setHasGallery(final boolean hasGallery) {
		this.hasGallery = hasGallery;
	}

	public void setHasListView(final boolean hasListView) {
		this.hasListView = hasListView;
	}

	public void setInitValue(final InitValue initValue) {
		this.mInitValue = initValue;
	}

	public final void setLayout(Layout layout) {
		mLayout = layout;
	}

	public void setListViewID(final String listViewID) {
		this.mListViewID = listViewID;
	}

	public void setOptionMenu(final ActionBarSpec optionMenu) {
		this.mOptionMenu = optionMenu;
	}

	public final void setSelectWhere(SelectWhere selectWhere) {
		mSelectWhere = selectWhere;
	}

}
